package com.huatai.bi.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.huatai.bi.entity.DataProcessEntity;
import com.huatai.bi.query.DirctProcessPageQuery;
import com.huatai.bi.query.PreviewDataQuery;
import com.huatai.bi.service.PointerDictionaryService;
import com.huatai.bi.vo.DirctProcessVO;
import com.huatai.common.api.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @BelongsProject: itc-airport-cloud
 * @BelongsPackage: com.huatai.bi.controller
 * @Author: hecaiy
 * @CreateTime: 2024-07-16  16:38
 * @Description: TODO
 * @Version: 1.0
 */
@RestController
@Api(value = "指标字典",tags = "指标字典")
@RequestMapping("/pointerDictionary")
public class DirctProcessController {
    @Autowired
    private PointerDictionaryService pointerDictionaryService;

    @ApiOperation(value = "数据字典分页获取数据")
    @PostMapping("/getDirctProcessPageData")
    public R<IPage<DirctProcessVO>> getDirctProcessPageData(@RequestBody DirctProcessPageQuery query) {
        return R.data(pointerDictionaryService.getDirctProcessPageData(query.getDataSetName(), query.getProcessName(), query.getPageIndex(), query.getPageSize()));
    }

    @ApiOperation(value = "获取弹框中的数据")
    @PostMapping("/getPageData")
    public R<IPage<DataProcessEntity>> getPageData(@RequestBody PreviewDataQuery query) {
        return R.data(pointerDictionaryService.getPageData(query.getDtId(), query.getPageIndex(), query.getPageSize()));
    }
}
